package com.xiaoxing.zhinenghuacangku_zhijian.mvp.ui.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xiaoxing.zhinenghuacangku_zhijian.R;
import com.xiaoxing.zhinenghuacangku_zhijian.mvp.ui.entity.FengQianLieBiao;

import java.util.List;

//import me.jessyan.armscomponent.commonres.utils.GlideUtil;


public class FengQianLieBiaoAdapter extends BaseQuickAdapter<FengQianLieBiao, BaseViewHolder> {

    private Context mContext;
    private IFengQianLieBiaoAdapter mIFengQianLieBiaoAdapter;

    public FengQianLieBiaoAdapter(Context context, @Nullable List<FengQianLieBiao> data, IFengQianLieBiaoAdapter iFengQianLieBiaoAdapter) {
        super(R.layout.item_feng_qian_lie_biao, data);
        this.mContext = context;
        this.mIFengQianLieBiaoAdapter = iFengQianLieBiaoAdapter;
    }

    @Override
    protected void convert(BaseViewHolder helper, FengQianLieBiao item) {
        //GlideUtil.loadImage(mContext,item.getImg(),helper.getView(R.id.img_head));
        helper.setText(R.id.tv_feng_yang_qu, "封样区: " + item.getBuffername());
        helper.setText(R.id.tv_dan_wei, "单位: " + item.getSpotunit());
        helper.setText(R.id.tv_yang_pin_shu_liang, "样品数量: " + item.getSpotnum());
        helper.setText(R.id.tv_qu_yang_ma, "取样码: " + item.getMonthid());
        helper.setText(R.id.tv_xiang_mu_ming_cheng, "项目名称: " + item.getProjectName());
        helper.setText(R.id.tv_xiang_mu_bian_hao, "项目编号: " + item.getProid());
        helper.setText(R.id.tv_qu_yang_wu_liao_ming_cheng, "取样物料名称: " + item.getMaterial());
        helper.setText(R.id.tv_gong_ying_shang, "供应商: " + item.getSupplier());
        helper.setOnClickListener(R.id.btn_sheng_cheng_feng_qian_ma, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mIFengQianLieBiaoAdapter.shengChengFengQianMa(item);
            }
        });
        helper.setOnClickListener(R.id.btn_song_jian, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mIFengQianLieBiaoAdapter.songJian(item);
            }
        });

    }

    public interface IFengQianLieBiaoAdapter {

        void shengChengFengQianMa(FengQianLieBiao fengQianLieBiao);

        void songJian(FengQianLieBiao fengQianLieBiao);

    }

}
